<!doctype html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="refresh" content="15" />
	<title>webMAN MOD</title>
</head>
<body bgcolor="#000" onload="initScriptedGauges();">

<center>
<style>button{font-family:verdana;font-size:20px;border-radius:12px;padding:5px 15px 5px 15px;}button:hover{color:blue;}</style>
<button onclick="self.location='/tempc.html';">Temp °C</button> &nbsp;
<button onclick="self.location='/cpursx.html';">Chart</button> &nbsp;
<button onclick="self.location='/restart.ps3';">Restart</button> &nbsp;
<button onclick="self.location='/shutdown.ps3';">Shutdown</button> &nbsp;
<hr>
<table cellpadding=15>
<tr>
<td>
<a href="/"><canvas id="temp1f" style="border-radius:9px;"></canvas></a><p>
<a href="/cpursx.ps3"><canvas id="temp2f" style="border-radius:9px;"></canvas></a></td>
<td><a href="/setup.ps3"><canvas id="fanspeed"></canvas></a></td>
</tr>
</table>
<canvas id="temp1c" style="display:none;"></canvas>
<canvas id="temp2c" style="display:none;"></canvas>

<script>
var t1c, t1f;
var t2c, t2f, fsp;
var cpu=0, rsx=0, fan=0;

function getCookie(cname) {
	var name = cname + "=";
	var decodedCookie = decodeURIComponent(document.cookie);
	var ca = decodedCookie.split(';');
	for(var i = 0; i <ca.length; i++) {
		var c = ca[i];
		while (c.charAt(0) == ' ') {
			c = c.substring(1);
		}
		if (c.indexOf(name) == 0) {
			return c.substring(name.length, c.length);
		}
	}
	return "0";
}

function initScriptedGauges() {

	setGaugeValues();

	if(cpu==0)cpu = parseInt(getCookie("cpu"));
	if(rsx==0)rsx = parseInt(getCookie("rsx"));
	if(fan==0)fan = parseInt(getCookie("fan"));

  t1c = new LinearGauge({
		renderTo: 'temp1c',
		width: 600,
		height: 180,
		units: 'CPU: ' + cpu + '°C',
		title: '',
		value: cpu,
		minValue: 20,
		maxValue: 100,
		majorTicks: [
			'20','30','40','50','60','70','80','90','100'
		],
		minorTicks: 5,
		strokeTicks: true,
		highlights: [
			{ from: 0, to: 30, color: 'gray' },
			{ from: 30, to: 50, color: 'blue' },
			{ from: 50, to: 70, color: 'green' },
			{ from: 70, to: 75, color: 'yellow' },
			{ from: 75, to: 80, color: 'orange' },
			{ from: 80, to: 100, color: 'red' },
		],
		colorPlate: cpu < 60 ? '#004' : cpu < 70 ? '#242' : cpu < 80 ? '#c80' : '#800',
		colorMajorTicks: '#f5f5f5',
		colorMinorTicks: '#ddd',
		colorTitle: '#fff',
		colorUnits: 'yellow',
		colorNumbers: '#eee',
		needleType: 'line',
		colorNeedle: 'rgba(240, 128, 128, 1)',
		colorNeedleEnd: 'rgba(255, 160, 122, .9)',
		valueBox: true,
		animationRule: 'bounce',
		animationDuration: 500
	}).draw();

  t2c = new LinearGauge({
		renderTo: 'temp2c',
		width: 600,
		height: 180,
		units: 'RSX: ' + rsx + '°C',
		title: '',
		value: rsx,
		minValue: 20,
		maxValue: 100,
		majorTicks: [
			'20','30','40','50','60','70','80','90','100'
		],
		minorTicks: 5,
		strokeTicks: true,
		highlights: [
			{ from: 0, to: 30, color: 'gray' },
			{ from: 30, to: 50, color: 'blue' },
			{ from: 50, to: 70, color: 'green' },
			{ from: 70, to: 75, color: 'yellow' },
			{ from: 75, to: 80, color: 'orange' },
			{ from: 80, to: 100, color: 'red' },
		],
		colorPlate: rsx < 60 ? '#004' : rsx < 70 ? '#242' : rsx < 80 ? '#c80' : '#800',
		colorMajorTicks: '#f5f5f5',
		colorMinorTicks: '#ddd',
		colorTitle: '#fff',
		colorUnits: 'white',
		colorNumbers: '#eee',
		needleType: 'line',
		colorNeedle: 'rgba(240, 128, 128, 1)',
		colorNeedleEnd: 'rgba(255, 160, 122, .9)',
		valueBox: true,
		animationRule: 'bounce',
		animationDuration: 500
	}).draw();

  fsp = new RadialGauge({
		renderTo: 'fanspeed',
		width: 400,
		height: 400,
		units: '% FAN',
		title: '',
		value: fan,
		minValue: 0,
		maxValue: 100,
		majorTicks: [
			'0','10','20','30','40','50','60','70','80','90','100'
		],
		minorTicks: 2,
		strokeTicks: false,
		highlights: [
			{ from: 0, to: 20, color: 'gray' },
			{ from: 20, to: 35, color: 'blue' },
			{ from: 35, to: 50, color: 'green' },
			{ from: 50, to: 65, color: 'yellow' },
			{ from: 65, to: 80, color: 'orange' },
			{ from: 80, to: 100, color: 'red' },
		],
		colorPlate: '#224',
		colorMajorTicks: '#f5f5f5',
		colorMinorTicks: '#ddd',
		colorTitle: '#fff',
		colorUnits: 'cyan',
		colorNumbers: '#eee',
		colorNeedle: 'rgba(240, 128, 128, 1)',
		colorNeedleEnd: 'rgba(255, 160, 122, .9)',
		valueBox: true,
		animationRule: 'bounce',
		animationDuration: 500
	}).draw();

  t1f = new LinearGauge({
		renderTo: 'temp1f',
		width: 600,
		height: 180,
		units: 'CPU: ' + cpu + '°F',
		title: '',
		value: (cpu*1.8)+32,
		minValue: 60,
		maxValue: 210,
		majorTicks: [
			'60','70','80','90','100','110','120','130','140','150','160','170','180','190','200','210'
		],
		minorTicks: 2,
		strokeTicks: true,
		highlights: [
			{ from: 30, to: 60, color: 'gray' },
			{ from: 60, to: 120, color: 'blue' },
			{ from: 120, to: 160, color: 'green' },
			{ from: 160, to: 170, color: 'yellow' },
			{ from: 170, to: 180, color: 'orange' },
			{ from: 180, to: 210, color: 'red' },
		],
		colorPlate: cpu < 60 ? '#004' : cpu < 70 ? '#242' : cpu < 80 ? '#c80' : '#800',
		colorMajorTicks: '#f5f5f5',
		colorMinorTicks: '#ddd',
		colorTitle: '#fff',
		colorUnits: 'yellow',
		colorNumbers: '#eee',
		colorNeedle: 'rgba(240, 128, 128, 1)',
		colorNeedleEnd: 'rgba(255, 160, 122, .9)',
		valueBox: true,
		animationRule: 'bounce',
		animationDuration: 500
	}).draw();

  t2f = new LinearGauge({
		renderTo: 'temp2f',
		width: 600,
		height: 180,
		units: 'RSX: ' + rsx + '°F',
		title: '',
		value: (rsx*1.8)+32,
		minValue: 60,
		maxValue: 210,
		majorTicks: [
			'60','70','80','90','100','110','120','130','140','150','160','170','180','190','200','210'
		],
		minorTicks: 2,
		strokeTicks: true,
		highlights: [
			{ from: 30, to: 60, color: 'gray' },
			{ from: 60, to: 120, color: 'blue' },
			{ from: 120, to: 160, color: 'green' },
			{ from: 160, to: 170, color: 'yellow' },
			{ from: 170, to: 180, color: 'orange' },
			{ from: 180, to: 210, color: 'red' },
		],
		colorPlate: rsx < 60 ? '#004' : rsx < 70 ? '#242' : rsx < 80 ? '#c80' : '#800',
		colorMajorTicks: '#f5f5f5',
		colorMinorTicks: '#ddd',
		colorTitle: '#fff',
		colorUnits: 'white',
		colorNumbers: '#eee',
		colorNeedle: 'rgba(240, 128, 128, 1)',
		colorNeedleEnd: 'rgba(255, 160, 122, .9)',
		valueBox: true,
		animationRule: 'bounce',
		animationDuration: 500
	}).draw();

	if(cpu) t1c.value=cpu;
	if(rsx) t2c.value=rsx;
	if(fan) fsp.value=fan;
	if(cpu) t1f.value=(cpu*1.8)+32;
	if(rsx) t2f.value=(rsx*1.8)+32;

	if(fan) document.cookie = "fan="+fan.toString()+";rsx="+rsx.toString()+";cpu="+cpu.toString()+";";
}
</script>
<script src="temp.js"></script>
<script src="gauge.min.js"></script>
</body>
</html>
